{extend name="main/index" /}

{block name="main"}
<div class="main-content">
    <div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
    try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
    </script>

    <ul class="breadcrumb">
    <li>
        <i class="icon-home home-icon"></i>
        <a href="#">Home</a>
    </li>

    <li>
        <a href="#">Other Pages</a>
    </li>
    <li class="active">分配角色</li>
    </ul><!-- .breadcrumb -->

    <div class="nav-search" id="nav-search">
    <form class="form-search">
        <span class="input-icon">
            <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
            <i class="icon-search nav-search-icon"></i>
        </span>
    </form>
    </div><!-- #nav-search -->
    </div>

    <div class="page-content">
    <div class="row">
    <div class="col-xs-12">
        <hr>
       给 <b>{$user['name']}</b> 分配
       <hr>
       <form action="{:url('admin/user/saverole')}" method='post'>
       <div style="margin-bottom: 20px;">
       <div id="ck">
       {volist name="list" id="v"}
           <input type="checkbox" name="role[]" value="{$v['id']}"
           <?php if (in_array($v['id'], $role) == true): ?>checked<?php endif; ?>>{$v['name']} 
           &nbsp;
           &nbsp;
           &nbsp;
           &nbsp;
           <?php if ($i%4 == 0): ?>
                 <br><hr>
           <?php endif; ?>
       {/volist}
       </div>
       </div>
       <hr>
       <input type="radio" onclick="ck(1)">全选========
       <input type="radio" onclick="ck(2)">全取消========
       <input type="radio" onclick="ck(3)">反选　
       <br><br>
       <input type="hidden" name="uid" value="{$user['id']}">
       <input type="submit" value="保存" class="btn btn-primary">
       </form>
    </div><!-- /.col -->
    </div><!-- /.row -->
    </div>
</div>
{/block}


{block name="myjs"}
{js href="/static/admin/assets/js/chosse.js"}
<!-- <script>
  // 导入到了chosse.js中
    var tr = document.getElementById('ck');
    var td = tr.getElementsByTagName('input');
    // var j = document.getElementById('j');
    // console.log(tr);

    function  ck(m) {
        for (var i = 0; i < td.length; i++) {
            switch(m){
                case 1:td[i].checked=true;break;
                case 2:td[i].checked=false;break;
                case 3:td[i].checked=!td[i].checked;break;
            }
        }
    }
</script> -->
{/block}


